package com.milling.web;

import spark.Spark;


public class WebhookListener {
    public static void main(String[] args) {
        // 设置客户端的回调端口
        Spark.port(9002);

        // 定义处理通知的路由
        Spark.post("/notification", (request, response) -> {
            String notification = request.body();
            System.out.println("Received notification from server: " + notification);

            // 处理通知逻辑
            processNotification(notification);

            // 返回响应给服务端
            response.status(200);
            return "Notification received successfully";
        });
    }

    private static void processNotification(String notification) {
        // 在这里实现你的通知处理逻辑
        System.out.println("Processing notification: " + notification);
    }
}
